{template header}

    {template title}

    <div class="box">
    <!--{if $a == 'index'}-->
        <table cellpadding="1" cellspacing="1" width="100%" border="0">
            <tr>
                <th width="20%">用户名</th>
                <!--<th width="15%">用户组</th>-->
                <th width="20%">最后登录时间</th>
                <th width="20%">最后登录IP</th>
                <th width="10%">状态</th>
                <th width="15%">管理选项</th>
            </tr>

        <!--{if $this->list}-->
            <!--{loop $this->list $val}-->
            <tr>
                <td>{$val["author"]}</td>
                <!--<td>[ <a href="">{$group[$val["sid"]]}</a> ]</td>-->
                <td>{echo formatDate($val['lastdate'])}</td>
                <td>{$val["lastip"]}</td>
                <td>{$this->status[$val['status']]}</td>
                <td>
                    <!--{if $val["id"] == $this->admin['id'] || $this->admin['id'] == 1}-->
                    <a class="btn btn-small" href="{$this->url( $c, 'edit', array('id' => $val['id']) )}">编辑</a>
                    <!--{/if}-->
                    <!--{if $val["id"] != $this->admin['id'] && $this->admin['id'] == 1 }-->
                    <a class="del btn btn-small btn-danger" title="删除用户" href="{$this->url( $c, 'del', array('id' => $val['id']) )}">删除</a>
                    <!--{/if}-->
                </td>
            </tr>
            <!--{/loop}-->
        <!--{/if}-->
        <!--{if $this->admin['id'] == 1}-->
            <tr>
                <th colspan="5" class="td6">
                    <a class="btn btn-success green" href="{$this->url($c, 'add')}">添加用户</a>
                </th>
            </tr>
         <!--{/if}-->
        </table>
    <!--{/if}-->
    <!--{if $a == 'add' || $a == 'edit'}-->
        <form method="post" action="{$this->url($c, 'save', array('id' => $result['id']) )}">
            <table cellpadding="1" cellspacing="1" width="100%" border="0">
                <tr>
                    <th colspan="2" class="td2">{$a == 'add' ? '添加' : '修改'}用户</th>
                </tr>
                <tr>
                    <td width="25%">用户名：</td>
                    <td class="td2">
                        <!--{if $a == 'edit'}-->
                        {$result['author']}
                        <!--{else}-->
                        <input type="text" name="author" placeholder="请输入用户名" class="required" />
                        <!--{/if}-->
                    </td>
                </tr>

                <!--{if $a == 'add'}-->
                <tr>
                    <td>密码：</td>
                    <td class="td2"><input type="password" placeholder="请输入密码" name="pass" class="required" /></td>
                </tr>
                <tr>
                    <td>重复密码：</td>
                    <td class="td2"><input type="password" placeholder="请重复输入密码" name="pass1" class="required pass" /></td>
                </tr>
                <!--{/if}-->

                <!--{if $a == 'edit'}-->
                <tr>
                    <td>新密码：</td>
                    <td class="td2"><input type="password" placeholder="如不更改密码，请留空" name="newpass" />
                        如不需要更改密码，此处请留空</td>
                </tr>
                <!--{/if}-->

                <tr>
                    <td>用户E-Mail：</td>
                    <td class="td2">
                        <input type="text" name="email" value="{$a == 'edit' ? $result['email'] : ''}" />
                    </td>
                </tr>

                <tr>
                    <td>用户组：</td>
                    <td class="td2">
                        <select name="sid" style="width: 190px;">
                            <!--{loop $this->sort $k $v}-->
                            <option value="{$k}"{$k == $result['sid'] ? ' selected' : ''}>{$v['title']}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>

                <!--{if $result['id'] != 1 && $this->admin['id'] == 1 }-->
                <tr>
                    <td>锁定用户：</td>
                    <td class="td2">
                        <input type="checkbox" name="status" value="1"{$a == 'edit' && $result['status'] ? ' checked' : ''} />
                    </td>
                </tr>
                <!--{/if}-->
                <tr>
                    <th colspan="2" class="td3">
                        <a class="btn btn-success save" href="{$this->url($c)}">保存</a>
                    </th>
                </tr>
            </table>
        </form>
        <!--{/if}-->
    </div>
{template footer}